<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%@ include file="/common/res.jsp" %>
    <%@ include file="/common/res-select2.jsp" %>
    <%@ include file="/common/res-datatable.jsp" %>
    <link rel="stylesheet" href="${ctx}/static/css/bootstrap.min-v3.3.0.css"/>
	<link rel="stylesheet" href="${ctx}/static/css/base.css">
    <title>客户管理</title>
</head>
<body>
<%@ include file="/common/head.jsp" %>
<div class="wrap-container">
    <div class="row">
        <div class="col-md-3 col-lg-2">
            <%@ include file="/common/left.jsp" %>
        </div>
        <div class="col-md-9 col-lg-10">
            <div class="cms-common-content">
                <h3>客户管理</h3>
                
                <div id="baseInfoShow">
              	 <h4 style="margin-top: 0;" >基本信息&nbsp;<a  href="javascript:;" onclick="editBaseInfo()">编辑</a></h4>
               	 <div class="bltitle-content">     
                   <table class="cms-detail-table fLeft" cellpadding="0" cellspacing="0" style="width:850px;">
                   		  <tr>
                          		<td>UID：<span id="memIdShow">${mem.id}</span></td>
                                <td>申请时间：${mem.createTime}</td>
                                
                          </tr>
                          
                          <tr>
                          		<td>真实姓名：<span id="realNameShow">${mem.realName}</span></td>
                          		<td>积分：<span id="integral">${mem.integral}</span></td>
                          </tr>
                          
                          <tr>
                          		<td>联系方式：<span id="mobileShow">${mem.mobile}</span></td>
                          		
                          		<c:if test="${mem.status=='1'}">
                                    <td>状态：可用</td>
                                </c:if>
                                <c:if test="${mem.status=='2'}">
                                    <td>状态：停用</td>
                                </c:if>
                          		
                          </tr>
                          
                   </table>
              </div>
           </div>
           <div id="baseInfoEdit">	  
               <h4 style="margin-top: 0;">基本信息&nbsp;<a  href="javascript:;" onclick="commitBaseInfo()">提交</a></h4>
               <div class="bltitle-content">     
                   <table class="cms-detail-table fLeft" cellpadding="0" cellspacing="0" style="width:850px;">
                   		  <tr>
                          		<td>UID：<input id="memId" value="${mem.id}" type="text" readonly="readonly"></span></td>
                                <td>申请时间：${mem.createTime}</td>
                          </tr>
                          
                          <tr>
                          		<td>昵称：<input id="realName" value="${mem.realName}" type="text"></input> </td>
                          		<td>积分：<span id="integral">${mem.integral}</span></td>
                          </tr>
                           
                          <tr>
                          		<td>联系方式：<input id="mobile" value="${mem.mobile}" type="text"></input></td>
                          </tr>
                          
                   </table>
              </div>
           </div>
           
           
           <h4>操作 备注</h4>
	  
	  		<input id="checkRemark" type="text" class="shenhe001" value="${mem.checkRemark }" onfocus="if (value =='请输入备注'){value =''}" onblur="if (value ==''){value='请输入备注'}" />
	  
		  <div class="sby_jin">
			  <button class="btn_endend" onclick="update_checkstatus('2', ${mem.status})">拉黑</button>
			  <button class="btn_endend" onclick="update_checkstatus('1', ${mem.status})">洗白</button>
		  </div>
           
        </div>
        <!--/.col-md-12-->
    </div>
    <!--/.row-->
</div>
<script>

$("#baseInfoShow").show();
$("#baseInfoEdit").hide();

function editBaseInfo(){
     $("#baseInfoShow").hide();
     $("#baseInfoEdit").show();
}

function commitBaseInfo(){

       $("#baseInfoShow").show();
       $("#baseInfoEdit").hide();
       
       var param = {};
       param.id=$("#memId").val();
       param.realName=$("#realName").val();
       param.mobile=$("#mobile").val();
       $.ajax({
	        type: "POST",
	        url: "${ctx}/op/mem/update",
	        data:param,
	        success: function(data){
	            if(data.success==false){
                         alert("提交失败");
                }
	            if(data.success == true){
	            	alert("提交成功");
	            	$("#realNameShow").html($("#realName").val());
	            	$("#mobileShow").html($("#mobile").val());
	            }

	        }
      });
      
}

function update_checkstatus(checkStatus, nowCheckStatus){
    var varCheckRemark = $("#checkRemark").val();
    if(varCheckRemark=='请输入备注'){
         varCheckRemark = '';
    }
    if(checkStatus == nowCheckStatus){
          alert("已经是需要的状态");
          return;
    }
    
    if(checkStatus != ''){
        var param = {};
	    param.id=$("#memId").val();
	    param.status=checkStatus;
	    param.checkRemark = varCheckRemark;
	    $.ajax({
	        type: "POST",
	        url: "${ctx}/op/mem/update",
	        data:param,
	        success: function(data){
	        	alert("操作成功");
	        	location.reload();
	        }
	      });
     }
    
    
   
}

</script>
</body>
</html>